home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / retofinv.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  19KB  |  577 lines

  1. /***************************************************************************
  2.  
  3. Return of the Invaders
  4.  
  5. driver by Jarek Parchanski, Andrea Mazzoleni
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10.  
  11. int  retofinv_vh_start(void);
  12. void retofinv_vh_stop(void);
  13. void retofinv_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  14. void retofinv_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  15. READ_HANDLER( retofinv_bg_videoram_r );
  16. READ_HANDLER( retofinv_fg_videoram_r );
  17. READ_HANDLER( retofinv_bg_colorram_r );
  18. READ_HANDLER( retofinv_fg_colorram_r );
  19. WRITE_HANDLER( retofinv_bg_videoram_w );
  20. WRITE_HANDLER( retofinv_fg_videoram_w );
  21. WRITE_HANDLER( retofinv_bg_colorram_w );
  22. WRITE_HANDLER( retofinv_fg_colorram_w );
  23. WRITE_HANDLER( retofinv_flip_screen_w );
  24.  
  25. extern size_t retofinv_videoram_size;
  26. extern unsigned char *retofinv_sprite_ram1;
  27. extern unsigned char *retofinv_sprite_ram2;
  28. extern unsigned char *retofinv_sprite_ram3;
  29. extern unsigned char *retofinv_fg_videoram;
  30. extern unsigned char *retofinv_bg_videoram;
  31. extern unsigned char *retofinv_fg_colorram;
  32. extern unsigned char *retofinv_bg_colorram;
  33. extern unsigned char *retofinv_fg_char_bank;
  34. extern unsigned char *retofinv_bg_char_bank;
  35.  
  36. static unsigned char cpu0_me000=0,cpu0_me800_last=0,cpu2_m6000=0;
  37.  
  38. static void retofinv_init_machine(void)
  39. {
  40.     cpu0_me800_last = 0;
  41.     cpu2_m6000 = 0;
  42. }
  43.  
  44. static READ_HANDLER( retofinv_shared_ram_r )
  45. {
  46.     unsigned char *RAM = memory_region(REGION_CPU1);
  47.     return RAM[0x8800+offset];
  48. }
  49.  
  50. static WRITE_HANDLER( retofinv_shared_ram_w )
  51. {
  52.     unsigned char *RAM = memory_region(REGION_CPU1);
  53.     RAM[0x8800+offset] = data;
  54. }
  55.  
  56. static WRITE_HANDLER( retofinv_protection_w )
  57. {
  58.     unsigned char *RAM = memory_region(REGION_CPU1);
  59.  
  60.     if (cpu0_me800_last & 0x80)
  61.     {
  62.         cpu0_me000 = data;
  63.         cpu0_me800_last = 0;
  64.         return;
  65.     }
  66.     else if (data < 0x10)
  67.     {
  68.         switch(data)
  69.         {
  70.             case 0x01:
  71.                 cpu0_me000 = ((cpu0_me000 >> 3) & 3) + 1;
  72.                 break;
  73.             case 0x02:
  74.                 cpu0_me000 = cpu0_me000 & 3;
  75.                 break;
  76.             default:
  77.                 cpu0_me000 = cpu0_me000;
  78.         }
  79.     }
  80.     else if (data > 0x0f)
  81.     {
  82.         switch(data)
  83.         {
  84.             case 0x30:
  85.                 cpu0_me000 = cpu0_me000;
  86.                 break;
  87.             case 0x40:
  88.                 cpu0_me000 = RAM[0x9800];
  89.                 break;
  90.             case 0x41:
  91.                 cpu0_me000 = RAM[0x9801];
  92.                 break;
  93.             case 0x42:
  94.                 cpu0_me000 = RAM[0x9802];
  95.                 break;
  96.             default:
  97.                 cpu0_me000 = 0x3b;
  98.                 break;
  99.         }
  100.     }
  101.     cpu0_me800_last = data;
  102. }
  103.  
  104. static READ_HANDLER( retofinv_protection_r )
  105. {
  106.     return cpu0_me000;
  107. }
  108.  
  109. static WRITE_HANDLER( reset_cpu2_w )
  110. {
  111.      if (data)
  112.         cpu_set_reset_line(2,PULSE_LINE);
  113. }
  114.  
  115. static WRITE_HANDLER( reset_cpu1_w )
  116. {
  117.     if (data)
  118.         cpu_set_reset_line(1,PULSE_LINE);
  119. }
  120.  
  121. static WRITE_HANDLER( cpu1_halt_w )
  122. {
  123.     cpu_set_halt_line(1, data ? CLEAR_LINE : ASSERT_LINE);
  124. }
  125.  
  126. static READ_HANDLER( protection_2_r )
  127. {
  128.     return 0;
  129. }
  130.  
  131. static READ_HANDLER( protection_3_r )
  132. {
  133.     return 0x30;
  134. }
  135.  
  136. static WRITE_HANDLER( cpu2_m6000_w )
  137. {
  138.     cpu2_m6000 = data;
  139. }
  140.  
  141. static READ_HANDLER( cpu0_mf800_r )
  142. {
  143.     return cpu2_m6000;
  144. }
  145.  
  146. static WRITE_HANDLER( soundcommand_w )
  147. {
  148.       soundlatch_w(0, data);
  149.       cpu_set_irq_line(2, 0, HOLD_LINE);
  150. }
  151.  
  152. static struct MemoryReadAddress readmem[] =
  153. {
  154.     { 0x0000, 0x5fff, MRA_ROM },
  155.     { 0x7b00, 0x7b00, protection_2_r },
  156.     { 0x8000, 0x83ff, retofinv_fg_videoram_r },
  157.     { 0x8400, 0x87ff, retofinv_fg_colorram_r },
  158.     { 0x8800, 0x9fff, retofinv_shared_ram_r },
  159.     { 0xa000, 0xa3ff, retofinv_bg_videoram_r },
  160.     { 0xa400, 0xa7ff, retofinv_bg_colorram_r },
  161.     { 0xc800, 0xc800, MRA_NOP },
  162.     { 0xc000, 0xc000, input_port_1_r },
  163.     { 0xc001, 0xc001, input_port_2_r },
  164.     { 0xc002, 0xc002, protection_2_r },
  165.     { 0xc003, 0xc003, protection_3_r },
  166.     { 0xc004, 0xc004, input_port_0_r },
  167.     { 0xc005, 0xc005, input_port_3_r },
  168.     { 0xc006, 0xc006, input_port_5_r },
  169.     { 0xc007, 0xc007, input_port_4_r },
  170.     { 0xe000, 0xe000, retofinv_protection_r },
  171.     { 0xf800, 0xf800, cpu0_mf800_r },
  172.     { -1 }    /* end of table */
  173. };
  174.  
  175. static struct MemoryWriteAddress writemem[] =
  176. {
  177.     { 0x0000, 0x5fff, MWA_ROM },
  178.     { 0x7fff, 0x7fff, MWA_NOP },
  179.     { 0x8000, 0x83ff, retofinv_fg_videoram_w, &retofinv_fg_videoram, &retofinv_videoram_size },
  180.     { 0x8400, 0x87ff, retofinv_fg_colorram_w, &retofinv_fg_colorram },
  181.     { 0x8800, 0x9fff, retofinv_shared_ram_w },
  182.     { 0x8f00, 0x8f7f, MWA_RAM, &retofinv_sprite_ram1 },    /* covered by the above, */
  183.     { 0x9700, 0x977f, MWA_RAM, &retofinv_sprite_ram2 },    /* here only to */
  184.     { 0x9f00, 0x9f7f, MWA_RAM, &retofinv_sprite_ram3 },    /* initialize the pointers */
  185.     { 0xa000, 0xa3ff, retofinv_bg_videoram_w, &retofinv_bg_videoram },
  186.     { 0xa400, 0xa7ff, retofinv_bg_colorram_w, &retofinv_bg_colorram },
  187.     { 0xb800, 0xb800, retofinv_flip_screen_w },
  188.     { 0xb801, 0xb801, MWA_RAM, &retofinv_fg_char_bank },
  189.     { 0xb802, 0xb802, MWA_RAM, &retofinv_bg_char_bank },
  190.     { 0xc800, 0xc800, MWA_NOP },
  191.     { 0xc801, 0xc801, reset_cpu2_w },
  192.     { 0xc802, 0xc802, reset_cpu1_w },
  193.     { 0xc803, 0xc803, MWA_NOP },
  194.     { 0xc804, 0xc804, MWA_NOP },
  195.     { 0xc805, 0xc805, cpu1_halt_w },
  196.     { 0xd800, 0xd800, soundcommand_w },
  197.     { 0xd000, 0xd000, MWA_NOP },
  198.     { 0xe800, 0xe800, retofinv_protection_w },
  199.     { -1 }    /* end of table */
  200. };
  201.  
  202. static struct MemoryReadAddress readmem_sub[] =
  203. {
  204.     { 0x0000, 0x1fff, MRA_ROM },
  205.     { 0x8000, 0x83ff, retofinv_fg_videoram_r },
  206.     { 0x8400, 0x87ff, retofinv_fg_colorram_r },
  207.     { 0x8800, 0x9fff, retofinv_shared_ram_r },
  208.     { 0xa000, 0xa3ff, retofinv_bg_videoram_r },
  209.     { 0xa400, 0xa7ff, retofinv_bg_colorram_r },
  210.     { 0xc804, 0xc804, MRA_NOP },
  211.     { 0xe000, 0xe000, retofinv_protection_r },
  212.     { 0xe800, 0xe800, MRA_NOP },
  213.     { -1 }    /* end of table */
  214. };
  215.  
  216. static struct MemoryWriteAddress writemem_sub[] =
  217. {
  218.     { 0x0000, 0x1fff, MWA_ROM },
  219.     { 0x8000, 0x83ff, retofinv_fg_videoram_w },
  220.     { 0x8400, 0x87ff, retofinv_fg_colorram_w },
  221.     { 0x8800, 0x9fff, retofinv_shared_ram_w },
  222.     { 0xa000, 0xa3ff, retofinv_bg_videoram_w },
  223.     { 0xa400, 0xa7ff, retofinv_bg_colorram_w },
  224.     { 0xc804, 0xc804, MWA_NOP },
  225.     { -1 }    /* end of table */
  226. };
  227.  
  228. static struct MemoryReadAddress readmem_sound[] =
  229. {
  230.     { 0x0000, 0x1fff, MRA_ROM },
  231.     { 0x2000, 0x27ff, MRA_RAM },
  232.     { 0x4000, 0x4000, soundlatch_r },
  233.     { 0xe000, 0xe000, MRA_NOP },          /* Rom version ? */
  234.     { -1 }    /* end of table */
  235. };
  236.  
  237. static struct MemoryWriteAddress writemem_sound[] =
  238. {
  239.     { 0x0000, 0x1fff, MWA_ROM },
  240.     { 0x2000, 0x27ff, MWA_RAM },
  241.     { 0x6000, 0x6000, cpu2_m6000_w },
  242.     { 0x8000, 0x8000, SN76496_0_w },
  243.     { 0xa000, 0xa000, SN76496_1_w },
  244.     { -1 }    /* end of table */
  245. };
  246.  
  247.  
  248. INPUT_PORTS_START( retofinv )
  249.     PORT_START      /* IN0 */
  250.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  251.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  252.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  253.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
  254.     PORT_BIT( 0x10, IP_ACTIVE_HIGH,IPT_COIN1 )
  255.     PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_COIN2 )
  256.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  257.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  258.  
  259.     PORT_START      /* IN1 */
  260.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  261.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_2WAY )
  262.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  263.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  264.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
  265.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
  266.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  267.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  268.  
  269.     PORT_START      /* IN2 */
  270.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  271.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_2WAY | IPF_COCKTAIL )
  272.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  273.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT  | IPF_2WAY | IPF_COCKTAIL )
  274.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
  275.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
  276.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  277.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  278.  
  279.     PORT_START      /* DSW1 */
  280.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
  281.     PORT_DIPSETTING(    0x03, "30k, 80k & every 80k" )
  282.     PORT_DIPSETTING(    0x02, "30k, 80k" )
  283.     PORT_DIPSETTING(    0x01, "30k" )
  284.     PORT_DIPSETTING(    0x00, "None" )
  285.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) )
  286.     PORT_DIPSETTING(    0x04, DEF_STR( No ) )
  287.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  288.     PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
  289.     PORT_DIPSETTING(    0x18, "1" )
  290.     PORT_DIPSETTING(    0x10, "2" )
  291.     PORT_DIPSETTING(    0x08, "3" )
  292.     PORT_DIPSETTING(    0x00, "4" )
  293.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  294.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  295.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  296.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  297.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  299.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  300.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  301.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  302.  
  303.     PORT_START      /* DSW3 modified by Shingo Suzuki 1999/11/03 */
  304.     PORT_BITX(    0x01, 0x01, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Push Start to Skip Stage", IP_KEY_NONE, IP_JOY_NONE )
  305.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  306.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  307.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  308.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  309.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  310.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  311.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  312.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  313.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  314.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  315.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  316.     PORT_DIPNAME( 0x10, 0x10, "Coin Per Play Display" )
  317.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  318.     PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
  319.     PORT_DIPNAME( 0x20, 0x20, "Year Display" )
  320.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  321.     PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
  322.     PORT_BITX(    0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  323.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  324.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  325.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Coinage ) )
  326.     PORT_DIPSETTING(    0x80, "A and B" )
  327.     PORT_DIPSETTING(    0x00, "A only" )
  328.  
  329.         PORT_START      /* DSW2 */
  330.     PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
  331.     PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) )
  332.     PORT_DIPSETTING(    0x0e, DEF_STR( 8C_1C ) )
  333.     PORT_DIPSETTING(    0x0d, DEF_STR( 7C_1C ) )
  334.     PORT_DIPSETTING(    0x0c, DEF_STR( 6C_1C ) )
  335.     PORT_DIPSETTING(    0x0b, DEF_STR( 5C_1C ) )
  336.     PORT_DIPSETTING(    0x0a, DEF_STR( 4C_1C ) )
  337.     PORT_DIPSETTING(    0x09, DEF_STR( 3C_1C ) )
  338.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  339.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  340.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  341.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  342.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
  343.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
  344.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
  345.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_7C ) )
  346.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_8C ) )
  347.     PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_B ) )
  348.     PORT_DIPSETTING(    0xf0, DEF_STR( 9C_1C ) )
  349.     PORT_DIPSETTING(    0xe0, DEF_STR( 8C_1C ) )
  350.     PORT_DIPSETTING(    0xd0, DEF_STR( 7C_1C ) )
  351.     PORT_DIPSETTING(    0xc0, DEF_STR( 6C_1C ) )
  352.     PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
  353.     PORT_DIPSETTING(    0xa0, DEF_STR( 4C_1C ) )
  354.     PORT_DIPSETTING(    0x90, DEF_STR( 3C_1C ) )
  355.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  356.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  357.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  358.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_3C ) )
  359.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
  360.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
  361.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
  362.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_7C ) )
  363.     PORT_DIPSETTING(    0x70, DEF_STR( 1C_8C ) )
  364. INPUT_PORTS_END
  365.  
  366.  
  367. static struct GfxLayout charlayout =
  368. {
  369.     8,8,    /* 8*8 characters */
  370.     512,    /* 512 characters */
  371.     1,    /* 1 bits per pixel */
  372.     { 0 },
  373.     { 0, 1, 2, 3, 4, 5, 6, 7 },        /* x bit */
  374.     { 56, 48, 40, 32, 24, 16, 8, 0 },    /* y bit */
  375.     8*8     /* every char takes 8 consecutive bytes */
  376. };
  377.  
  378. static struct GfxLayout bglayout =
  379. {
  380.     8,8,    /* 8*8 characters */
  381.     512,    /* 512 characters */
  382.     4,    /* 4 bits per pixel */
  383.     { 0, 0x2000*8+4, 0x2000*8, 4 },
  384.     { 8*8+3, 8*8+2, 8*8+1, 8*8+0, 3, 2, 1, 0 },
  385.     { 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
  386.     16*8    /* every char takes 16 consecutive bytes */
  387. };
  388.  
  389. static struct GfxLayout spritelayout =
  390. {
  391.     16,16,    /* 16*16 characters */
  392.     256,    /* 256 characters */
  393.     4,    /* 4 bits per pixel */
  394.     { 0, 0x4000*8+4, 0x4000*8, 4 },
  395.     { 24*8+3, 24*8+2, 24*8+1, 24*8+0, 16*8+3, 16*8+2, 16*8+1, 16*8+0,
  396.       8*8+3, 8*8+2, 8*8+1, 8*8+0, 3, 2, 1, 0 },
  397.     { 39*8, 38*8, 37*8, 36*8, 35*8, 34*8, 33*8, 32*8,
  398.       7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
  399.       64*8    /* every char takes 64 consecutive bytes */
  400. };
  401.  
  402. static struct GfxDecodeInfo gfxdecodeinfo[] =
  403. {
  404.     { REGION_GFX1, 0, &charlayout,             0, 256 },
  405.     { REGION_GFX2, 0, &bglayout,           256*2,  64 },
  406.     { REGION_GFX3, 0, &spritelayout, 64*16+256*2,  64 },
  407.     { -1 } /* end of array */
  408. };
  409.  
  410.  
  411.  
  412. static struct SN76496interface sn76496_interface =
  413. {
  414.     2,        /* 2 chips */
  415.     { 3072000, 3072000 },    /* ??? */
  416.     { 80, 80 }
  417. };
  418.  
  419.  
  420.  
  421. static struct MachineDriver machine_driver_retofinv =
  422. {
  423.     /* basic machine hardware */
  424.     {
  425.         {
  426.             CPU_Z80,
  427.             3072000,
  428.             readmem, writemem,0,0,
  429.             interrupt,1
  430.         },
  431.         {
  432.             CPU_Z80,
  433.             3072000,
  434.             readmem_sub, writemem_sub,0,0,
  435.             interrupt,1
  436.         },
  437.         {
  438.             CPU_Z80,
  439.             3072000,
  440.             readmem_sound, writemem_sound,0,0,
  441.             nmi_interrupt,2
  442.         },
  443.     },
  444.     60,DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  445.     100,                    /* 100 CPU slices per frame - enough for the sound CPU to read all commands */
  446.     0,
  447.     /* video hardware */
  448.     36*8, 32*8,
  449.     { 0*8, 36*8-1, 2*8, 30*8-1 },
  450.     gfxdecodeinfo,
  451.     256, 256*2+64*16+64*16,
  452.     retofinv_vh_convert_color_prom,
  453.  
  454.     VIDEO_TYPE_RASTER,
  455.     0,
  456.     retofinv_vh_start,
  457.     retofinv_vh_stop,
  458.     retofinv_vh_screenrefresh,
  459.  
  460.     /* sound hardware */
  461.     0,0,0,0,
  462.     {
  463.         {
  464.             SOUND_SN76496,
  465.             &sn76496_interface
  466.         }
  467.     }
  468. };
  469.  
  470. /***************************************************************************
  471.  
  472.   Game driver(s)
  473.  
  474. ***************************************************************************/
  475.  
  476. ROM_START( retofinv )
  477.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  478.     ROM_LOAD( "ic70.rom", 0x0000, 0x2000, 0xeae7459d )
  479.     ROM_LOAD( "ic71.rom", 0x2000, 0x2000, 0x72895e37 )
  480.     ROM_LOAD( "ic72.rom", 0x4000, 0x2000, 0x505dd20b )
  481.  
  482.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for code */
  483.     ROM_LOAD( "ic62.rom", 0x0000, 0x2000, 0xd2899cc1 )
  484.  
  485.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for sound cpu */
  486.     ROM_LOAD( "ic17.rom", 0x0000, 0x2000, 0x9025abea )
  487.  
  488.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  489.     ROM_LOAD( "ic61.rom", 0x0000, 0x2000, 0x4e3f501c )
  490.  
  491.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  492.     ROM_LOAD( "ic55.rom", 0x0000, 0x2000, 0xef7f8651 )
  493.     ROM_LOAD( "ic56.rom", 0x2000, 0x2000, 0x03b40905 )
  494.  
  495.     ROM_REGION( 0x08000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  496.     ROM_LOAD( "ic8.rom",  0x0000, 0x2000, 0x6afdeec8 )
  497.     ROM_LOAD( "ic9.rom",  0x2000, 0x2000, 0xd3dc9da3 )
  498.     ROM_LOAD( "ic10.rom", 0x4000, 0x2000, 0xd10b2eed )
  499.     ROM_LOAD( "ic11.rom", 0x6000, 0x2000, 0x00ca6b3d )
  500.  
  501.     ROM_REGION( 0x0b00, REGION_PROMS )
  502.     ROM_LOAD( "74s287.p6", 0x0000, 0x0100, 0x50030af0 )    /* palette blue bits   */
  503.     ROM_LOAD( "74s287.o6", 0x0100, 0x0100, 0xe8f34e11 )    /* palette green bits */
  504.     ROM_LOAD( "74s287.q5", 0x0200, 0x0100, 0xe9643b8b )    /* palette red bits  */
  505.     ROM_LOAD( "82s191n",   0x0300, 0x0800, 0x93c891e3 )    /* lookup table */
  506. ROM_END
  507.  
  508. ROM_START( retofin1 )
  509.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  510.     ROM_LOAD( "roi.02",  0x0000, 0x2000, 0xd98fd462 )
  511.     ROM_LOAD( "roi.01b", 0x2000, 0x2000, 0x3379f930 )
  512.     ROM_LOAD( "roi.01",  0x4000, 0x2000, 0x57679062 )
  513.  
  514.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for code */
  515.     ROM_LOAD( "ic62.rom", 0x0000, 0x2000, 0xd2899cc1 )
  516.  
  517.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for sound cpu */
  518.     ROM_LOAD( "ic17.rom", 0x0000, 0x2000, 0x9025abea )
  519.  
  520.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  521.     ROM_LOAD( "ic61.rom", 0x0000, 0x2000, 0x4e3f501c )
  522.  
  523.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  524.     ROM_LOAD( "ic55.rom", 0x0000, 0x2000, 0xef7f8651 )
  525.     ROM_LOAD( "ic56.rom", 0x2000, 0x2000, 0x03b40905 )
  526.  
  527.     ROM_REGION( 0x08000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  528.     ROM_LOAD( "ic8.rom",  0x0000, 0x2000, 0x6afdeec8 )
  529.     ROM_LOAD( "ic9.rom",  0x2000, 0x2000, 0xd3dc9da3 )
  530.     ROM_LOAD( "ic10.rom", 0x4000, 0x2000, 0xd10b2eed )
  531.     ROM_LOAD( "ic11.rom", 0x6000, 0x2000, 0x00ca6b3d )
  532.  
  533.     ROM_REGION( 0x0b00, REGION_PROMS )
  534.     ROM_LOAD( "74s287.p6", 0x0000, 0x0100, 0x50030af0 )    /* palette blue bits   */
  535.     ROM_LOAD( "74s287.o6", 0x0100, 0x0100, 0xe8f34e11 )    /* palette green bits */
  536.     ROM_LOAD( "74s287.q5", 0x0200, 0x0100, 0xe9643b8b )    /* palette red bits  */
  537.     ROM_LOAD( "82s191n",   0x0300, 0x0800, 0x93c891e3 )    /* lookup table */
  538. ROM_END
  539.  
  540. ROM_START( retofin2 )
  541.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  542.     ROM_LOAD( "ri-c.1e", 0x0000, 0x2000, 0xe3c31260 )
  543.     ROM_LOAD( "roi.01b", 0x2000, 0x2000, 0x3379f930 )
  544.     ROM_LOAD( "ri-a.1c", 0x4000, 0x2000, 0x3ae7c530 )
  545.  
  546.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for code */
  547.     ROM_LOAD( "ic62.rom", 0x0000, 0x2000, 0xd2899cc1 )
  548.  
  549.     ROM_REGION( 0x10000, REGION_CPU3 )    /* 64k for sound cpu */
  550.     ROM_LOAD( "ic17.rom", 0x0000, 0x2000, 0x9025abea )
  551.  
  552.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  553.     ROM_LOAD( "ic61.rom", 0x0000, 0x2000, 0x4e3f501c )
  554.  
  555.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  556.     ROM_LOAD( "ic55.rom", 0x0000, 0x2000, 0xef7f8651 )
  557.     ROM_LOAD( "ic56.rom", 0x2000, 0x2000, 0x03b40905 )
  558.  
  559.     ROM_REGION( 0x08000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  560.     ROM_LOAD( "ic8.rom",  0x0000, 0x2000, 0x6afdeec8 )
  561.     ROM_LOAD( "ic9.rom",  0x2000, 0x2000, 0xd3dc9da3 )
  562.     ROM_LOAD( "ic10.rom", 0x4000, 0x2000, 0xd10b2eed )
  563.     ROM_LOAD( "ic11.rom", 0x6000, 0x2000, 0x00ca6b3d )
  564.  
  565.     ROM_REGION( 0x0b00, REGION_PROMS )
  566.     ROM_LOAD( "74s287.p6", 0x0000, 0x0100, 0x50030af0 )    /* palette blue bits   */
  567.     ROM_LOAD( "74s287.o6", 0x0100, 0x0100, 0xe8f34e11 )    /* palette green bits */
  568.     ROM_LOAD( "74s287.q5", 0x0200, 0x0100, 0xe9643b8b )    /* palette red bits  */
  569.     ROM_LOAD( "82s191n",   0x0300, 0x0800, 0x93c891e3 )    /* lookup table */
  570. ROM_END
  571.  
  572.  
  573.  
  574. GAME( 1985, retofinv, 0,        retofinv, retofinv, 0, ROT270, "Taito Corporation", "Return of the Invaders" )
  575. GAME( 1985, retofin1, retofinv, retofinv, retofinv, 0, ROT270, "bootleg", "Return of the Invaders (bootleg set 1)" )
  576. GAME( 1985, retofin2, retofinv, retofinv, retofinv, 0, ROT270, "bootleg", "Return of the Invaders (bootleg set 2)" )
  577.